/**
 * 
 */
package com.oauth.global.client.ui;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.oauth.components.client.ui.HasWidgetInfo;

/**
 * @author asanthan
 * 
 */
public class WidgetMenuClickListener implements ClickHandler {

	private HasWidgetInfo widget;
	private WidgetPanel widgetPanel;

	public WidgetMenuClickListener(HasWidgetInfo w, WidgetPanel widgetPanel) {
		super();
		this.widget = w;
		this.widgetPanel = widgetPanel;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt
	 * .event.dom.client.ClickEvent)
	 */
	@Override
	public void onClick(ClickEvent event) {
		widgetPanel.setWidget(widget);
		widget.init();
	}

}
